import requests
import json
from tkinter import *
import time

height = 500
width = 750

#测试华为云API接口
def testAPI():
    print('testAPI')

    token = 'MIIVWAYJKoZIhvcNAQcCoIIVSTCCFUUCAQExDTALBglghkgBZQMEAgEwghNqBgkqhkiG9w0BBwGgghNbBIITV3sidG9rZW4iOnsiZXhwaXJlc19hdCI6IjIwMjEtMDQtMjFUMDg6NTM6NTkuNTM5MDAwWiIsIm1ldGhvZHMiOlsicGFzc3dvcmQiXSwiY2F0YWxvZyI6W10sInJvbGVzIjpbeyJuYW1lIjoidGVfYWRtaW4iLCJpZCI6IjAifSx7Im5hbWUiOiJ0ZV9hZ2VuY3kiLCJpZCI6IjAifSx7Im5hbWUiOiJvcF9nYXRlZF9jc2UyLjBfY2ZnIiwiaWQiOiIwIn0seyJuYW1lIjoib3BfZ2F0ZWRfZGNzX21zX3J3cyIsImlkIjoiMCJ9LHsibmFtZSI6Im9wX2dhdGVkX2Vjc19zcG90X2luc3RhbmNlIiwiaWQiOiIwIn0seyJuYW1lIjoib3BfZ2F0ZWRfaXZhc192Y3JfdmNhIiwiaWQiOiIwIn0seyJuYW1lIjoib3BfZ2F0ZWRfZWNzX2FzY2VuZF9rYWkxIiwiaWQiOiIwIn0seyJuYW1lIjoib3BfZ2F0ZWRfZWNzX2thZTEiLCJpZCI6IjAifSx7Im5hbWUiOiJvcF9nYXRlZF9kYnNfcmkiLCJpZCI6IjAifSx7Im5hbWUiOiJvcF9nYXRlZF9ldnNfZXNzZCIsImlkIjoiMCJ9LHsibmFtZSI6Im9wX2dhdGVkX2Vjc19ncHVfdjEwMCIsImlkIjoiMCJ9LHsibmFtZSI6Im9wX2dhdGVkX2NzZTIuMF9ndm4iLCJpZCI6IjAifSx7Im5hbWUiOiJvcF9nYXRlZF9kd3NfcG9jIiwiaWQiOiIwIn0seyJuYW1lIjoib3BfZ2F0ZWRfY2JyX2ZpbGUiLCJpZCI6IjAifSx7Im5hbWUiOiJvcF9nYXRlZF9lY3Nfa2MxX3VzZXJfZGVmaW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-rzl-8IT5g='
    reqHeader = {'Content-Type' : 'application/json' , 'X-Auth-Token' : token}

    myProId = '0ab348c1da80102b2fc8c001fe6c3e08'
    URI_sheme = 'https://'
    Endpoint = 'nlp-ext.cn-north-4.myhuaweicloud.com'
    resource_path = '/v1/' + myProId + '/nlg/summarization'
    msg = {
        'length_limit':0.3 ,
        'title':'多任务模型',
        'lang':'zh' ,  
        'content':'多任务模型通过学习不同任务的联系和差异，可提高每个任务的学习效率和质量。多任务学习的的框架广泛采用shared-bottom的结构，不同任务间共用底部的隐层。这种结构本质上可以减少过拟合的风险，但是效果上可能受到任务差异和数据分布带来的影响。也有一些其他结构，比如两个任务的参数不共用，但是通过对不同任务的参数增加L2范数的限制；也有一些对每个任务分别学习一套隐层然后学习所有隐层的组合。和shared-bottom结构相比，这些模型对增加了针对任务的特定参数，在任务差异会影响公共参数的情况下对最终效果有提升。缺点就是模型增加了参数量所以需要更大的数据量来训练模型，而且模型更复杂并不利于在真实生产环境中实际部署使用。'
    }
    str_json = json.dumps(msg)
    uri = URI_sheme + Endpoint + resource_path
    print(uri)
    print(msg)
    response = requests.post(uri, headers = reqHeader, data = str_json)
    #response.encoding = 'UTF-8'
    #mjson = response.json()
    #print(mjson)
    print(response.text)

#获取令牌Token
def getAuth():
    print('getAuth')
    #token = 'MIIVLwYJKoZIhvcNAQcCoIIVIDCCFRwCAQExDTALBglghkgBZQMEAgEwghNBBgkqhkiG9w0BBwGgghMyBIITLnsidG9rZW4iOnsiZXhwaXJlc19hdCI6IjIwMjEtMDQtMjFUMDg6NDQ6MjcuMjc4MDAwWiIsIm1ldGhvZHMiOlsicGFzc3dvcmQiXSwiY2F0YWxvZyI6W10sImRvbWFpbiI6eyJuYW1lIjoiaHc5NDM4NzExNyIsImlkIjoiMGFiMzQ1ODE0NDAwMGYxZTBmMzJjMDAxNTE4MTJiZTAifSwicm9sZXMiOlt7Im5hbWUiOiJ0ZV9hZG1pbiIsImlkIjoiMCJ9LHsibmFtZSI6InNlY3Vf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CAQEwgZcwgYkxCzAJBgNVBAYTAkNOMRIwEAYDVQQIDAlHdWFuZ0RvbmcxETAPBgNVBAcMCFNoZW5aaGVuMS4wLAYDVQQKDCVIdWF3ZWkgU29mdHdhcmUgVGVjaG5vbG9naWVzIENvLiwgTHRkMQ4wDAYDVQQLDAVDbG91ZDETMBEGA1UEAwwKY2EuaWFtLnBraQIJANyzK10QYWoQMAsGCWCGSAFlAwQCATANBgkqhkiG9w0BAQEFAASCAQBYQ9zgMHi5uaNC8ZS0FLUQfTS4VGzRC6ksD7IffRJxdEnPqtl2e1ujT6837rDlqIo11hDiVk0k4fcRr3GCoc8gCTRP7HpZ3wWpFb05hNZshDvcJsm7l1rldzWLdc52JhsimK006W74mBYdXL4OIyECfEAnvbsj-DGPSTzSS4zM411b3DTdwQPfIVYPLvMOxzvPjb6m5AOwHZ69GIQ4mBxyiedrpAf-sKuY2iu93AeJudKHAZottY8Dr8x6UDvR+JY-0eOwNyoJ0VQyrtDe3kfy8GFwpEnianndfzIADf8pZggN7V5OAkkTRFf8HaelWxiJce+SCS4JNi8zBmt4tB8A'

def gui_start():
    init_window = Tk()              #实例化出一个父窗口
    textSumm = CY_GUI(init_window)
    # 设置根窗口默认属性
    textSumm.set_init_window()
    #init_window.resizable(width=False, height=False)

    init_window.mainloop()          #父窗口进入事件循环，可以理解为保持窗口运行，否则界面不展示


class CY_GUI():
    def __init__(self,init_window_name):
        self.init_window_name = init_window_name

    #设置窗口
    def set_init_window(self):
        self.init_window_name.title("文本摘要生成")           #窗口名
        #self.init_window_name.geometry('320x160+10+10')                         #290 160为窗口大小，+10 +10 定义窗口弹出时的默认展示位置
        self.init_window_name.geometry('%dx%d+10+10'%(width,height))
        #self.init_window_name["bg"] = "pink"                                    #窗口背景色，其他背景色见：blog.csdn.net/chl0000/article/details/7657887
        #self.init_window_name.attributes("-alpha",0.9)                          #虚化，值越小虚化程度越高
        #标签
        self.init_data_label = Label(self.init_window_name, text="待处理数据")
        self.init_data_label.grid(row=0, column=0)
        self.result_data_label = Label(self.init_window_name, text="MASS输出结果")
        self.result_data_label.grid(row=0, column=6)
        self.result_data_label = Label(self.init_window_name, text="华为云输出结果")
        self.result_data_label.grid(row=3, column=6)
        #self.log_label = Label(self.init_window_name, text="日志")
        #self.log_label.grid(row=12, column=0)
        #文本框
        self.init_data_Text = Text(self.init_window_name, width = 48, height = 25)  #原始数据录入框
        self.init_data_Text.grid(row=1, column=0, rowspan=5, columnspan=6)
        self.result_data_Text = Text(self.init_window_name, width = 40, height = 10)  #处理结果展示
        self.result_data_Text.grid(row=1, column=6, rowspan=2, columnspan=5)
        self.result_data_Text = Text(self.init_window_name, width = 40, height = 10)  #处理结果展示
        self.result_data_Text.grid(row=4, column=6, rowspan=2, columnspan=5)

        #按钮
        #mass模型调用
        self.str_trans_to_md5_button = Button(self.init_window_name, text="mass模型调用", bg="lightblue", width=10,height = 1, command=self.mPrint)  # 调用内部方法  加()为直接调用
        self.str_trans_to_md5_button.grid(row=3, column=7)
        #华为云接口调用
        self.huawei_sum = Button(self.init_window_name, text="华为云API调用", bg="lightblue", width=10, command= self.huaweiRes)
        self.huawei_sum.grid(row = 7, column = 7)
        #用于演示
        self.show_first = Button(self.init_window_name, text="演示1", bg="red", width=10, command= self.showRes1)
        self.show_first.grid(row = 7, column = 1)
        self.show_second = Button(self.init_window_name, text="演示2", bg="green", width=10, command= self.showRes2)
        self.show_second.grid(row = 7, column = 2)

    def mPrint(self):
        print("hhhh")

    def showRes1(self):
        print('entry shoeRes1')


    def showRes2(self):
        print('entry shoeRes2')

    def huaweiRes(self):
        print('entry huaweiRes')

    #获取当前时间
    def get_current_time(self):
        current_time = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
        return current_time


if __name__ == '__main__':
    #response = requests.get('http://www.baidu.com')
    #getAuth()
    #testAPI()
    print('entry main')
    gui_start()
